#ifndef __SECURITYLIST_H__
#define __SECURITYLIST_H__

#include "facecat/stdafx.h"
#include "Security.h"
#include "DataCenter.h"
#include "facecat/FCGridRow.h"
#include "facecat/FCGridCellExtends.h"
#include "facecat/FCMenu.h"
#include "facecat/FCSplitLayoutDiv.h"
#include "facecat/FCGrid.h"

/*
 *行的扩展
 */
class GridRowEx: public FCGridRow{
public:
    /*
     * 重绘方法
     */
    virtual void onPaint(FCPaint *paint, const FCRect& clipRect, bool isAlternate);
};

class FCGridNoCell: public FCGridIntCell{
public:
    virtual int getInt();
    virtual String getText();
};

class FCGridDoubleCellEx: public FCGridDoubleCell{
public:
    FCGridDoubleCellEx();
    bool m_underLine;
    /*
     * 重绘方法
     *@param paint 绘图对象
     *@param rect 矩形
     *@param clipRect 裁剪矩形
     *@param isAlternate 是否交替行
     */
    virtual void onPaint(FCPaint paint, const FCRect& rect, const FCRect& clipRect, bool isAlternate);
    
};

class FCGridUnitDoubleCell: public FCGridDoubleCell{
public:
    FCGridUnitDoubleCell(){};
    virtual String getPaintText();
    
};

class FCGridUnitLongCell: public FCGridDoubleCell{
public: FCGridUnitLongCell(){};
    virtual String getPaintText();
};

class FCGridPECell: public FCGridDoubleCell{
public:
    FCGridPECell(){};
    virtual String getPaintText();
};

/*
 * 股票列表
 */
class SecurityList: public FCGrid, public FCListenerMessageCallBack, public FCInvokeEventCallBack{
public:
    SecurityList();
    int m_requestID;
    HashMap<String, FCGridRow*> m_rowsMap;
    bool m_clickLeftOrRight;
    bool m_firstAdd;
    /*
     *绑定代码
     *@param code
     */
    void bindCodes(ArrayList<Security*>codes);
    /*
     * 行的缓存
     */
public:
    /*
     * 跨线程调用
     *@param eventName
     *@param sender
     *@param args
     *@param invoke
     */
    void callInvokeEvent(String eventName, Object sendre, Object args, Object invoke);
    /*
     * 回调方法
     *@param sender
     *@param message
     *@param invoke
     */
    void callListenerMessageEvent(Object sender, FCMessage *message, Object invoke);
    virtual void onTouchDown(FCTouchInfo touchInfo);
    /*
     * 添加视图方法
     */
    virtual void onAdd();
    /*
     * 查询数据
     *@param securities
     */
    void searchCodes(ArrayList<Security*> securities);
    /*
     * 第一次搜索代码
     */
    void firstSearchCode();
    virtual void onSelectedRowsChanged();
};

#endif
